var a = require("../../@babel/runtime/helpers/toConsumableArray"), t = getApp();

Page({
    data: {
        listData: [],
        statistics: {},
        info: {},
        location: {},
        isLoadMore: !0,
        total_page: 0,
        page: 1
    },
    onLoad: function(a) {
        this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    onShareAppMessage: function() {},
    gotoAwardsRecord: function(a) {
        var t = a.currentTarget.dataset.id;
        wx.navigateTo({
            url: "/packageE/regionalAwards/regionalAwardsRecord/regionalAwardsRecord?id=" + t
        });
    },
    _getMoreData: function() {
        var o = this, e = this;
        if (!(this.data.page >= this.data.total_page)) {
            var s = t.getNetAddresss("plugin.regional-reward.Frontend.controllers.quota.index");
            this.data.page++, t._postNetWork({
                url: s,
                data: {
                    page: this.data.page
                },
                success: function(t) {
                    var s = t.data;
                    if (1 == s.result) {
                        s.data.list.current_page >= s.data.getRecord.last_page && e.setData({
                            isLoadMore: !1
                        });
                        var i = o.data.listData;
                        i.push.apply(i, a(s.data.getRecord.data)), o.setData({
                            listData: i
                        });
                    }
                },
                fail: function(a) {
                    console.log(a.msg);
                }
            });
        }
    },
    getData: function() {
        var a = this, o = this, e = t.getNetAddresss("plugin.regional-reward.Frontend.controllers.quota.index");
        t._postNetWork({
            url: e,
            success: function(t) {
                var e = t.data;
                if (1 != e.result) return a.tips(e.msg);
                a.data.total_page = e.data.list.last_page || 0, e.data.list.current_page >= e.data.list.last_page && o.setData({
                    isLoadMore: !1
                }), a.setData({
                    location: e.data.location,
                    statistics: e.data.statistics,
                    info: e.data.info,
                    listData: e.data.list.data
                });
            },
            fail: function(a) {
                console.log(a.msg);
            }
        });
    },
    tips: function(a) {
        return wx.showToast({
            title: a,
            icon: "none",
            duration: 2e3
        }), !1;
    }
});